package autorization;

/**
 * The exception class. To use a case if registration of user is failed in system
 * @author Volk ID = 1001 
 */
public class RegistrationFailed extends Exception{
   //---------------------Аттрибуты класса---------------------
     public static final int LOGIN_ERROR = 0; 
     public static final int PASSWORD_ERROR = 1; 
     
     private int typeFailed; 
   //----------------------------------------------------------
   
   //----The interface methoods-----------------------------------------
   /**
    * Constructor
    * @param typeFailed - type of error
    * @throws java.lang.RuntimeException - To generate a case non-correct data-in
    */
   public RegistrationFailed(int typeFailed) throws RuntimeException{
     switch(typeFailed){
         case LOGIN_ERROR:
         case PASSWORD_ERROR: 
         this.typeFailed = typeFailed; 
         break; 
         
         default: 
          throw new RuntimeException(); 
     }     
   }
    /**
     * To get the type of current error
     * @return - type of error, can be LOGIN_ERROR, else PASSWORD_ERROR
     */
    public int getTypeFailed(){return typeFailed;}     
   //-------------------------------------------------------------------
}
